package com.itheima.streamdemo.myStream;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class MyStreamDemo6 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("张三,23", "李四,24", "王五,25"));

        Map<String, String> map = list.stream().filter(s -> Integer.parseInt(s.split(",")[1]) >= 24)
                .collect(Collectors.toMap(
                        s -> s.split(",")[0],
                        s -> s.split(",")[1]));
        System.out.println(map);

    }
}

